package com.mdz.nc.Controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mdz.nc.Entity.SysSpkfk;
import com.mdz.nc.Mapper.SysSpkfkMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 孟德志
 * @since 2020-03-28
 */
@Controller
@RequestMapping("/nc/sysSpkfk")
public class SysSpkfkController {

    @Autowired
    private SysSpkfkMapper sysSpkfkMapper;
    @Autowired
    private HttpSession session;

    @RequestMapping(value = "/getspkfk",method = RequestMethod.GET)
    public String getspkfk(@RequestParam(value = "pn", defaultValue = "1" ) Integer pn, ModelMap map){
        PageHelper.startPage(pn, 20);
        List<SysSpkfk> spkfkList=sysSpkfkMapper.selectList(null);
        PageInfo page=new PageInfo(spkfkList,5);
        map.put("pageInfo",page);
        map.put("username",session.getAttribute("username"));
        return "search";
    }
}

